package by.semerikov.parts;

public class Ipv4 extends Ip{

	private Integer[] codes = new Integer[4];
	
	public Ipv4()
	{
		
	}
	
	public Integer[] getCodes() {
		return codes;
	}

	public void setCodes(Integer[] codes) {
		this.codes = codes;
	}

	public Ipv4(int pr1,int pr2,int pr3,int pr4)
	{
		if(pr1<255||pr1>0)
		{
			codes[0] = pr1;
		}
		if(pr2<255||pr2>0)
		{
			codes[1] = pr2;
		}
		if(pr3<255||pr3>0)
		{
			codes[2] = pr3;
		}
		if(pr4<255||pr4>0)
		{
			codes[3] = pr4;
		}
		
	}
	
	@Override
	public String toString() {
		
		return codes[0].toString() + "." + codes[1].toString() + "." + codes[2].toString() + "." + codes[3].toString();
	}
	
	

}
